home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / GOODNAME.BAS < prev    next >
BASIC Source File  |  1989-08-31  |  630b  |  26 lines

  1. ' GOODNAME.BAS
  2. ' This program separates first and last names and prints them.
  3.  
  4. CLS
  5.  
  6. PRINT "Enter your first and last name in the following format:  ";
  7. PRINT "Lastname, Firstname"
  8. PRINT
  9.  
  10. LINE INPUT "Name:  ", fullName$
  11.  
  12. commaLocation% = INSTR(1, fullName$, ",")
  13.  
  14. IF (commaLocation% > 0) THEN
  15.     lastName$ = LEFT$(fullName$, commaLocation% - 1)
  16.     firstName$ = RIGHT$(fullName$, LEN(fullName$) - commaLocation% - 1)
  17.  
  18.     PRINT
  19.     PRINT "What a lovely name!  It's so nice to meet you, ";
  20.     PRINT firstName$; " "; lastName$; "!"
  21. ELSE
  22.     PRINT
  23.     PRINT "Name not in Lastname, Firstname format."
  24. END IF
  25.  
  26.